<template>
	<view class="container">
		<u-navbar left-icon="chat" bell left-icon-size="30" title="My Profile"></u-navbar>
		<view class="header" :style="{marginTop: marginSwiperHeight}">
			<view class="avatar">
				<image src="../../../static/images/profile/avatar.png" mode=""></image>
			</view>
			<view class="user-info">
				<text class="user-name">Majed Shammary</text>
				<text calss="user-email" style="margin-top: 5rpx;">majeddukhi@gmail.com</text>
				<view class="info-button">
					<button class="edit">EDIT PROFILE</button>
					<button class="logout">LOG OUT</button>
				</view>
			</view>
		</view>
		<view class="center">
			<view class="center-item">
				<image src="../../../static/images/profile/icons/menu.png" mode=""></image>
				<text>All my Orders</text>
				<image src="../../../static/images/profile/icons/right.png" mode=""></image>
			</view>
			<view class="center-item">
				<image src="../../../static/images/profile/icons/pending.png" mode=""></image>
				<text>Pending Shipments</text>
				<image src="../../../static/images/profile/icons/right.png" mode=""></image>
			</view>
			<view class="center-item">
				<image src="../../../static/images/profile/icons/language.png" mode=""></image>
				<text>Language</text>
				<image src="../../../static/images/profile/icons/right.png" mode=""></image>
			</view>
			<view class="center-item">
				<image src="../../../static/images/profile/icons/finish.png" mode=""></image>
				<text>Finished Orders</text>
				<image src="../../../static/images/profile/icons/right.png" mode=""></image>
			</view>
		</view>
		<view class="center" style="margin-top: 48rpx;">
			<view class="center-item">
				<image src="../../../static/images/profile/icons/invite.png" mode=""></image>
				<text>Invite Friends</text>
				<image src="../../../static/images/profile/icons/right.png" mode=""></image>
			</view>
			<view class="center-item">
				<image src="../../../static/images/profile/icons/customer.png" mode=""></image>
				<text>Customer Support</text>
				<image src="../../../static/images/profile/icons/right.png" mode=""></image>
			</view>
			<view class="center-item">
				<image src="../../../static/images/profile/icons/collect.png" mode=""></image>
				<text>Rate Our App</text>
				<image src="../../../static/images/profile/icons/right.png" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				marginSwiperHeight: '', //导航栏高度
			}
		},
		methods: {
			//导航栏的高度
			getBarHeight() {
				this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
				this.marginSwiperHeight = this.iStatusBarHeight + 44 + 'px';
			},
		},
		created() {
			uni.pageScrollTo({
				scrollTop: 0, // 滚动到页面的目标位置（单位px）
				duration: 0 // 滚动动画的时长，默认300ms，单位 ms
			});
			this.getBarHeight();
		}
	}
</script>

<style lang="scss">
	.header {
		padding: 60rpx 40rpx;
		display: flex;

		.avatar image {
			width: 120rpx;
			height: 120rpx;
			border-radius: 100%;
			background-color: #65DACC;
		}

		.user-info {
			display: flex;
			flex-direction: column;
			margin-left: 30rpx;
			color: #515C6F;

			.user-name {
				font-size: 38rpx;
			}

			.user-email {
				font-size: 30rpx;
			}

			.info-button {
				margin-top: 25rpx;
				display: flex;
				align-items: center;

				.edit {
					width: 240rpx;
					height: 58rpx;
					font-size: 24rpx;
					color: #727C8E;
					border-radius: 50rpx;
					border: 1rpx solid #727C8E;
				}

				.logout {
					width: 168rpx;
					height: 58rpx;
					font-size: 24rpx;
					color: #fff;
					border-radius: 50rpx;
					background-color: #F0867F;
					margin-left: 14rpx;
				}
			}
		}
	}

	.center {
		margin-top: 28rpx;
		display: flex;
		flex-direction: column;

		.center-item {
			display: flex;
			align-items: center;
			background-color: #fff;
			margin: 0 40rpx;
			padding: 30rpx 0;
			border-bottom: 2rpx solid #F1F2F3;

			image:not(:last-child) {
				width: 50rpx;
				height: 50rpx;
				margin-left: 34rpx;
			}

			image:last-child {
				width: 36rpx;
				height: 36rpx;
				margin-right: 32rpx;
			}

			text {
				margin-left: 30rpx;
				flex: 1;
				color: #515C6F;
			}
		}

		/* 首尾圆角 */
		.center-item:first-child {
			border-radius: 20rpx 20rpx 0 0;
		}

		.center-item:last-child {
			border-radius: 0 0 20rpx 20rpx;
		}
	}

	button::after {
		border: initial;
	}
</style>